package test;

import java.util.ArrayList;
import java.util.NoSuchElementException;

import diseaseandcureadministration.registry.Registrable;
import diseaseandcureadministration.registry.Registry;
import diseaseandcureadministration.symptom.Symptom;
import diseaseandcureadministration.symptom.SymptomRegistry;
import diseaseandcureadministration.symptom.SymptomSeverity;

public class SymptomRegistryRunner 
{

	public static void main(String[] args) 
	{
		Registry symptomsRegTest = SymptomRegistry.getRegistryInstance();
		
		symptomsRegTest.load();
		symptomsRegTest.save();
		
		System.out.println("test getSymptom");
		System.out.println(symptomsRegTest.getElementByName("nausea").toString());
		System.out.println("Expected: Nausea, TRIVIAL");
		System.out.println();
		
		try
		{
			symptomsRegTest.getElementByName("Ass Itch");
		}
		catch (NoSuchElementException e)
		{
			System.out.println(e.getMessage());
		}
		System.out.println("Expected: There is no element of that name in the registry");
		System.out.println();
		
		System.out.println("test getAll:");
		ArrayList<Registrable> symptoms = symptomsRegTest.getAll();
		for(Registrable symptom: symptoms)
		{
			System.out.println(symptom.toString());
		}
		System.out.println("Expected:");
		System.out.println("Coughing, TRIVIAL \n" +
							"Nausea, TRIVIAL \n" +
							"Dizzyness, TRIVIAL \n" +
							"Hairloss, SERIOUS \n" +
							"Fever, SERIOUS \n" +
							"Asphyxiation, LIFETHREATENING");
		System.out.println();
		
		System.out.println("test addElement:");
		symptomsRegTest.addElement(new Symptom("Bleeding Ass", SymptomSeverity.LIFETHREATENING));
		symptoms = symptomsRegTest.getAll();
		for(Registrable symptom: symptoms)
		{
			System.out.println(symptom.toString());
		}
		System.out.println("Expected:");
		System.out.println("Coughing, TRIVIAL \n" +
							"Nausea, TRIVIAL \n" +
							"Dizzyness, TRIVIAL \n" +
							"Throat Ache, TRIVIAL \n" +
							"Confusion, TRIVIAL \n" +
							"Hairloss, SERIOUS \n" +
							"Fever, SERIOUS \n" +
							"Low Blood Pressure, SERIOUS \n" +
							"Asphyxiation, LIFETHREATENING \n" +
							"Bleeding Ass, LIFETHREATENING");
		System.out.println();
	}

}
